package com.xinlu.common.game.dao;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import com.xinlu.derek.common.BaseDao;
import com.xinlu.persistence.WcSjgl;

public class WcSjglDao extends BaseDao {

	public List getLottyList(Timestamp currentTime, String yxms) {

		String hql = " from WcSjgl ws where ws.dgjssj > ? and yxms = ? ";

		return super.find(hql, new Object[] { currentTime, yxms });

	}

	/**
	 * 
	 * Function : 获取当前期的详细信息
	 * 
	 * @param currenttTimestamp
	 * @return Derek 2011-5-21 下午03:37:05
	 */
	public WcSjgl getNewQishuXinxi(Date currenttTimestamp, String yxms) {

		String hql = " from WcSjgl ws where ? between ws.dgkssj and ws.dgjssj and ws.yxms = ? ";

		List list = super.find(hql, new Object[] { currenttTimestamp, yxms });

		return list != null && list.size() > 0 ? (WcSjgl) list.get(0) : null;
	}

	/**
	 * 根据期号查找代购结束时间
	 * 
	 * @param qh
	 * @return
	 */
	public String getDgjssjByQh(String qh, String yxms) {
		String hql = "select s.dgjssj from WcSjgl s where s.yxms='" + yxms + "' and s.qh = '" + qh + "'";
		List list = super.find(hql);

		return (list != null && list.size() > 0 ? list.get(0) + "" : "");
	}

}
